import { createStore } from 'vuex'

export default createStore({
  state: {
    username: '江子',
    taskList: []
  },

  mutations: {
    add(state: any, value: string) {
      state.taskList.push({ name: value, isfinished: false })
    },
    del(state: any, index: number) {
      state.taskList.splice(index, 1)
    },
    updates(state: any, payload: any) {
      const { index, isfinished } = payload;
      state.taskList[index].isfinished = isfinished
    }
    
  }
});
